#include <stdio.h>
#include <string.h>
#include "../NetTalk/NetTalk.h"

void OnClientConnected(UnicodeStringPtr clientAddress)
{
	printf("%S connected\n", clientAddress);
}

void OnDataReceived(UnicodeStringPtr clientAddress, BytePtr data, int dataLength)
{
	printf("%S says: %s\n", clientAddress, data);
}

void OnClientDisconnected(UnicodeStringPtr clientAddress)
{
	printf("%S disconnected\n", clientAddress);
}

int main (int argc, const char * argv[]) 
{
	NTCallbacks ntCallbacks;
	memset(&ntCallbacks, 0, sizeof(ntCallbacks));
	ntCallbacks.clientConnectionCallback = OnClientConnected;
	ntCallbacks.clientDisconnectionCallback = OnClientDisconnected;
	ntCallbacks.dataReceivedCallback = OnDataReceived;
	
	NTInit(&ntCallbacks);
	NTAwaitConnection(5555);
	
	return 0;
}
